CHARTS
Photo by Tomas Williams on Unsplash
Sometimes, the world from above seems too beautiful, too wonderful, too distant for human eyes to see….
— Charles A. Lindbergh
# Create dataset
df = read.csv("archetypes/airline-passenger-traffic/projected-growth-in-airline-passenger-traffic-by-region.csv", header = TRUE)
# Prepare the data
df$xmax <- cumsum(df$RPK)
df$xmin <- df$xmax - df$RPK
df$xlabel <- (df$xmax + df$xmin)/2
df$label <- paste(as.character(df$Growth),"%")
data<-df %>% rename(Regions=Region)
data
theme_opts <- theme(
text = element_text(family = "inconsolata", size = 16),
plot.title = element_text(color = "black", size = 16, face = "bold"),
plot.subtitle = element_text(color = "black", size = 12),
plot.caption = element_text(color = "#555555", size = 11),
plot.background = element_blank(),
plot.margin = unit(c(0, 0, 1.25, 0), "in"),
legend.position = "none",
legend.title = element_blank(),
axis.text = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background=element_rect(fill="white", colour="white"),
panel.border = element_blank()
)
v1 <- ggplot(data) +
geom_rect(aes(ymin = 0, ymax = Growth, xmin = xmin, xmax = xmax, fill = Regions), color = "white", alpha = 0.8 ) +
geom_text(aes(x = xlabel, y = Growth, label = label, vjust = -1), position = "identity", color = "black", size = 3, family = "inconsolata" ) +
geom_text(aes(x = xlabel, y = 0.2, label = format(RPK, big.mark = ",", scientific = FALSE), vjust = 0), position = "identity", color = "black", size = 3, family = "inconsolata" ) +
geom_text(aes(x = max(xlabel), y = 2.0, label = "Estimated\nRPK (B)\nin 2035"), vjust = 0.5, family = "inconsolata") +
geom_text(aes(x = xlabel, y = 0, label = Regions), hjust = "right", vjust = 1.5, position = "identity", color = "black", size = 3.5, angle = 45, family = "inconsolata" ) +
geom_hline(yintercept = 4.8, linetype = "dashed") +
geom_text(aes(max(xlabel), 4.9, label = "World Traffic - Growth 4.8%"), vjust = 0.0, family = "inconsolata") +
geom_hline(yintercept = 2.9, linetype = "dashed") +
geom_text(aes(max(xlabel), 3.0, label = "World GDP -Growth 2.9%"), vjust = 0.0, family = "inconsolata") +
scale_fill_brewer(palette = "Spectral") +
coord_cartesian(clip="off") +
labs(title = "Projected Annual Growth in Revenue Passenger Kilometers (RPK)", subtitle = "2015-2035 (top 10 regional flows)") +
theme_bw() +
theme_opts
girafe(ggobj = v1, width_svg = 16, height_svg = 9,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))